
const CityList = require('../../components/cityList/cityList.js')
const ChooseCity = require('../../components/chooseCity/chooseCity.js')


Page({

  /**
   * 页面的初始数据
   */
  data: {

    headShowArray:[
      "https://spics.hitour.cc/9cef296d4226cbaa3518039a9f88d9d5.jpg",
      "https://spics.hitour.cc/3089e31f9d995efa518a41c8a119e06c.jpg",
      "https://spics.hitour.cc/beea6bcf797bdb796729664ca104f8f8.jpg"

    ],
    isShowCityList:false,
    depName: "出发地",
    arrvieName:"目的地",
    btnName:"",
    markers: [{
      iconPath: "/images/driverView/depCityIcon.png",
      id: 0,
      latitude: 23.099994,
      longitude: 113.324520,
      width: 30,
      height: 30
    }],
    hasChangeMap: true,
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let self = this
    let app = getApp()
    self.chooseCity = new ChooseCity(self)
    self.chooseCity.getAppLoction()
    // app.appGetLocation(self.chooseCity.appLoctionCB)
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  showCalendarView: function (res) {
    wx.navigateTo({
      url: '/pages/calendarComponent/calendarComponent',
    })
  },



  showSearchList: function (res) {


    let self = this
    let app = getApp()
    let depName = self.data.depName                       //出发地
    let arrvieName = self.data.arrvieName                 //目的地

    if (depName == "出发地") {
      wx.showToast({
        image: '/images/noWayWhite.png',
        title: '请选择出发地',
      })
      return
    } else if (arrvieName == "目的地") {
      wx.showToast({
        image: '/images/noWayWhite.png',
        title: '请选择目的地',
      })
      return
    }


    let depAddBean = self.data.depAddBean
    let arrAddBean = self.data.arrAddBean
    let hasChooseDepName = self.data.hasChooseDepName
    var sendDepProvince = ''                              //出发地省名
    var sendDepCity = ''                                  //目的地市名
    let sendArrProvince = arrAddBean.REGION_PROVINCE      //出发地省名
    var sendArrCity = arrAddBean.REGION_CITY              //目的地市区

    if (hasChooseDepName == true) {
      sendDepProvince = depAddBean.REGION_PROVINCE
      sendDepCity = depAddBean.REGION_CITY
    } else {
      sendDepProvince = app.globalData.currentProvince
      sendDepCity = app.globalData.currentCity
    }

   


    var para = {
     
      departure: depName,
      destination: arrvieName,
      sendDepProvince: sendDepProvince,
      sendDepCity: sendDepCity,
      sendArrProvince: sendArrProvince,
      sendArrCity: sendArrCity,

    } 

    console.log('sousuo', para)
    wx.navigateTo({
      url: '/pages/orderListView/orderListView',
    })

    // wx.showToast({
    //   title: '还没做,别点了',
    //   icon: 'loading',
    //   duration: 2000
    // })
  },

  showOrderList: function (res) {
   wx.navigateTo({
     url: '/pages/orderListView/orderListView',
   })
  },



  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})